home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3274 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: Rezonet.net!news
  2. From: ray@ultimate-tech.com (Ray Dunn)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is it possible?
  5. Date: 25 Jan 1996 05:09:35 GMT
  6. Organization: Ultimate Technographics Inc.
  7. Message-ID: <4e73af$dvl@ns.RezoNet.NET>
  8. References: <4e5kuq$9i7@news.ust.hk>
  9. NNTP-Posting-Host: 204.19.230.7
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.7
  13.  
  14. In referenced article, Chu Shiu Chung says...
  15. >     If I have declare the following:
  16. >          #define FILENUM  12
  17. >
  18. >     Is it possible to make the compiler to replace this in printf:
  19. >           printf("FILENUM is the number of files");
  20. >instead of
  21. >           printf("%d is the number of files", FILENUM);
  22. >
  23. >Just like what the compiler do in: int a=FILENUM;
  24.  
  25. No, because macros are not expanded inside string literals, and 
  26. there's no way you can get the expansion of FILENUM inside string 
  27. quotes, either by using the stringizing operator, or anything else.
  28.  
  29. Another minus for 'C's preprocessing capabilities.
  30. -- 
  31. Ray Dunn (opinions are my own) | Phone: (514) 938 9050
  32. Montreal                       | Phax : (514) 938 5225
  33. ray@ultimate-tech.com          | Home : (514) 630 3749
  34.  
  35.